<?php
namespace LPCISII\PHP2012Bundle\DataFixtures\ORM;

use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use LPCISII\PHP2012Bundle\Entity\Images;

use Doctrine\Common\Persistence\ObjectManager;

class ImageFixtures extends AbstractFixture implements OrderedFixtureInterface {

    public function load(ObjectManager $manager) {
        $image = new Images();
        $image->setTitre('Vélo');
        $image->setUrl('velo.jpg');
        $image->setArticle($manager->merge($this->getReference('vélo')));
        $manager->persist($image);

        $image2 = new Images();
        $image2->setTitre('Fiat Panda 1');
        $image2->setUrl('fiatpanda1.jpg');
        $image2->setArticle($manager->merge($this->getReference('panda')));
        $manager->persist($image2);
        
        $image3 = new Images();
        $image3->setTitre('Fiat Panda 2');
        $image3->setUrl('fiatpanda2.jpg');
        $image3->setArticle($manager->merge($this->getReference('panda')));
        $manager->persist($image3);
        
        $image4 = new Images();
        $image4->setTitre('Trotinette');
        $image4->setUrl('trotinette.jpg');
        $image4->setArticle($manager->merge($this->getReference('trotinette')));
        $manager->persist($image4);
        
        $image5 = new Images();
        $image5->setTitre('MacBook Pro 13 pouces');
        $image5->setUrl('macbook.jpg');
        $image5->setArticle($manager->merge($this->getReference('macbook')));
        $manager->persist($image5);
        
        $image6 = new Images();
        $image6->setTitre('Disquette');
        $image6->setUrl('disquette.jpg');
        $image6->setArticle($manager->merge($this->getReference('disquette')));
        $manager->persist($image6);
        
        $image7 = new Images();
        $image7->setTitre('Clé USB 8Go');
        $image7->setUrl('cle-usb-8go.jpg');
        $image7->setArticle($manager->merge($this->getReference('cle')));
        $manager->persist($image7);
        
        $image8 = new Images();
        $image8->setTitre('Guitare sèche bon état');
        $image8->setUrl('guitare-seche.jpg');
        $image8->setArticle($manager->merge($this->getReference('guitare')));
        $manager->persist($image8);
        
        $image9 = new Images();
        $image9->setTitre('Flute alors !');
        $image9->setUrl('flute.jpg');
        $image9->setArticle($manager->merge($this->getReference('flute')));
        $manager->persist($image9);
        
        $image10 = new Images();
        $image10->setTitre('Korn');
        $image10->setUrl('korn.jpg');
        $image10->setArticle($manager->merge($this->getReference('korn')));
        $manager->persist($image10);
        
        $image11 = new Images();
        $image11->setTitre('Jojo');
        $image11->setUrl('jojo.jpg');
        $image11->setArticle($manager->merge($this->getReference('jojo')));
        $manager->persist($image11);
        
        $image12 = new Images();
        $image12->setTitre('Ruby');
        $image12->setUrl('ruby.jpg');
        $image12->setArticle($manager->merge($this->getReference('ruby')));
        $manager->persist($image12);
        
        $image13 = new Images();
        $image13->setTitre('Warhammer Livre d\'armées');
        $image13->setUrl('war-armees.JPG');
        $image13->setArticle($manager->merge($this->getReference('warhammer')));
        $manager->persist($image13);
        
        $manager->flush();
    }

    public function getOrder() {
        return 4;
    }
}